num = 100


for i in range(1,num+1):
    if i % 7 == 0 or (i % 7 !=0 and str(i).count('7') > 0):
        print(i,end=' ')
print()
print("  *  ** **")
print(" *** *   *")
print("*****")
print(" *** *   *")
print("  *  ** **")
for i in range(1,num+1):
    if i % 7 == 0 or ("7" in str(i)):
        print(i,end=' ')